package cn.yuan.xiaoyu.testmodule.activity;

import android.os.Bundle;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.webkit.WebView;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import butterknife.Bind;
import cn.yuan.xiaoyu.R;
import cn.yuan.xiaoyu.commonmodule.glide.GlideCircleTransform;
import cn.yuan.xiaoyu.commonmodule.utils.L;
import cn.yuan.xiaoyu.testmodule.view.ChoseStatusFrameLayout;

/**
 * Created by yukuoyuan on 2017/4/8.
 */

public class BActivity extends DemoBaseActivity {

    @Bind(R.id.iv_test_circle)
    ImageView ivTestCircle;
    @Bind(R.id.wv_test)
    WebView wvTest;

    @Override
    protected void initData(Bundle extras) {
        L.i("BActivity", "onCreate()");
        csfTest.showErrorLayout();
        csfTest.setOnErrorLayoutButttonClickListener(new ChoseStatusFrameLayout.OnErrorLayoutButttonClickListener() {
            @Override
            public void onRefreshDataButtonClick() {
                getData();
            }
        });
        Glide.with(this).load("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3838618543,2315140366&fm=111&gp=0.jpg").transform(new GlideCircleTransform(this)).into(ivTestCircle);
    }

    private void getData() {
        AlphaAnimation alphaAnimation = new AlphaAnimation(0.3f, 1.0f);
        alphaAnimation.setDuration(5000l);
        csfTest.setAnimation(alphaAnimation);
        alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                //当动画加载完毕之后
                csfTest.showContentLayout();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        L.i("BActivity", "onRestart()");
    }

    @Override
    protected void onStart() {
        super.onStart();
        L.i("BActivity", "onStart()");
    }

    @Override
    protected void onResume() {
        super.onResume();
        L.i("BActivity", "onResume()");
    }

    @Override
    protected void onPause() {
        super.onPause();
        L.i("BActivity", "onPause()");
    }

    @Override
    protected void onStop() {
        super.onStop();
        L.i("BActivity", "onStop()");
    }

    @Override
    protected void bindPresenter() {

    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_a;
    }

    @Override
    protected void initToolbar() {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }



}
